package cn.easybuy.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.easybuy.entity.ProductCategory;
import cn.easybuy.service.ProductCategoryService;
import cn.easybuy.service.impl.ProductCategoryServiceImpl;

/**
 * Servlet implementation class GoodsServlet
 */
@WebServlet("/GoodsServlet")
public class GoodsServlet extends HttpServlet {
	ProductCategoryService pcService = null;
	
	@Override
	public void init() throws ServletException {
		pcService = new ProductCategoryServiceImpl();
	}
	 
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		System.out.println("进入到商品的Servlet");
		//查询商品信息 略
		
		//查询一级分类下拉框
		int pid = 0;
		List<ProductCategory> pc1_list= pcService.getProductCategroyByPid(pid);
		request.setAttribute("pc1_list", pc1_list);
		
		//转发
		request.getRequestDispatcher("back/Member_GoodUpdate.jsp").forward(request, response);
		//response.sendRedirect("back/Member_GoodUpdate.jsp");
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
